package com.turing.post.organization.util;

import java.io.Serializable;
import java.math.BigInteger;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

/**
 * 凭证库存实体类
 * 
 * @author wzd
 * 
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "VOUCHERSTOCK")
@IdClass(VoucherStock.class)
public class VoucherStock implements Serializable {
	/**
	 * 凭证ID
	 */
	private BigInteger voucherId;
	/**
	 * 凭证号
	 */
	private String voucherNo;
	/**
	 * 发卡商No
	 */
	private String issueCompanyNo;
	/**
	 * 所属发卡机构
	 */
	private String issueBranchNo;
	/**
	 * 所属销售机构
	 */
	private String saleBranchNo;
	/**
	 * 状态
	 */
	private String status;

	/**
	 * 正常
	 */
	public static final String Status_0 = "0";
	/**
	 * 在途
	 */
	public static final String Status_1 = "1";
	/**
	 * 2 –使用
	 */
	public static final String Status_2 = "2";

	/**
	 * 丢失、损坏等
	 */
	public static final String Status_9 = "9";
	

	public VoucherStock() {

	}

	@Id
	@Column(name = "VOUCHERID", nullable = false)
	public BigInteger getVoucherId() {
		return voucherId;
	}

	public void setVoucherId(BigInteger voucherId) {
		this.voucherId = voucherId;
	}

	@Id
	@Column(name = "voucherNo", nullable = false)
	public String getVoucherNo() {
		return voucherNo;
	}

	public void setVoucherNo(String voucherNo) {
		this.voucherNo = voucherNo;
	}
	@Column(name = "issueCompanyNo", nullable = false)
	public String getIssueCompanyNo() {
		return issueCompanyNo;
	}
   
	public void setIssueCompanyNo(String issueCompanyNo) {
		this.issueCompanyNo = issueCompanyNo;
	}
	@Column(name = "issueBranchNo")
	public String getIssueBranchNo() {
		return issueBranchNo;
	}

	public void setIssueBranchNo(String issueBranchNo) {
		this.issueBranchNo = issueBranchNo;
	}
	@Column(name = "saleBranchNo")
	public String getSaleBranchNo() {
		return saleBranchNo;
	}

	public void setSaleBranchNo(String saleBranchNo) {
		this.saleBranchNo = saleBranchNo;
	}
	@Column(name = "status", nullable = false)
	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime
				* result
				+ ((getVoucherNo() == null) ? 0 : getVoucherNo()
						.hashCode());
		result = prime * result
				+ ((getVoucherId() == null) ? 0 : getVoucherId().hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final VoucherStock other = (VoucherStock) obj;
		if (getVoucherNo() == null) {
			if (other.getVoucherNo() != null)
				return false;
		} else if (!getVoucherNo().equals(other.getVoucherNo()))
			return false;
		if (getVoucherId() == null) {
			if (other.getVoucherId() != null)
				return false;
		} else if (!getVoucherId().equals(other.getVoucherId()))
			return false;
		return true;
	}
}